﻿using System;
using MagicOnion;
using MessagePack;

namespace RPCTestShared
{
    // define interface as Server/Client IDL.
    // implements T : IService<T> and share this type between server and client.
    public interface IMyFirstService : IService<IMyFirstService>
    {
        // Return type must be `UnaryResult<T>` or `Task<UnaryResult<T>>`.
        // If you can use C# 7.0 or newer, recommend to use `UnaryResult<T>`.
        UnaryResult<int> SumAsync(int x, int y);

        UnaryResult<ProjectData> CreateProjectData(ProjectPoint point);
    }

    [MessagePackObject]
    public class ProjectData
    {
        [Key(0)]
        public string DataId { get; set; }
        [Key(1)]
        public string Title { get; set; }
        [Key(2)]
        public DateTime ModifyTime { get; set; }
    }

    [MessagePackObject]
    public class ProjectPoint
    {
        [Key(0)]
        public string ProjectId { get; set; }
        [Key(1)]
        public string ProjectName { get; set; }
    }
}
